package com.ntv.persistent.news.sql.impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.ntv.domain.INews;
import com.ntv.domain.News;

public class NewsMapper implements RowMapper 
{
	public Object mapRow(ResultSet rs, int rowNum) throws SQLException 
	{
//		  `news_id`		
//		  `date`		
//		  `location`		
//		  `head_line`		
//		  `complete_news`	
//		  `created_by`		
//		  `date_of_creation`	
//		  `updated_by`		
//		  `date_of_update`	
//		  `has_content`		
//		  `content_id`		
//		  `is_top_news`		
//		  `position`		
//		  is_authorized	
		//INews news  = new News();
		//news.setId(rs.getLong("news_id"));
		//news.setPublishedOn(rs.getDate("date"));
		//news.setLocation(rs.getString("location"));
		//news.setHeadLine(rs.getString("head_line"));
//		news.setCompleteNews(rs.getString("complete_news"));
		//news.setCreatedBy(rs.getLong("created_by"));
		//news.setCreatedOn(rs.getDate("date_of_creation"));
		//news.setUpdatedOn(rs.getDate("date_of_update"));
//		news.setCategory(rs.getString("news_category"));
//		news.setCategoryId(rs.getString("type_id"));
//		news.setUpdatedOn(rs.getDate("date_of_update"));
//		news.setContentId(rs.getLong("content_id"));
		
		
		INews news  = new News();
		news.setId(rs.getLong("news_id"));
		news.setCompleteNews(rs.getString("complete_news"));
		news.setLocation(rs.getString("location"));
		news.setHeadLine(rs.getString("head_line"));
		news.setCategory(rs.getString("news_category"));
		news.setCategoryId(rs.getString("type_id"));
		news.setPublishedOn(rs.getDate("published_on"));
		news.setCreatedOn(rs.getDate("date_of_creation"));
		news.setUpdatedOn(rs.getDate("date_of_update"));
		news.setContentId(rs.getLong("content_id"));
		//return news;
		
		return news;
	}
}